package com.mdjnu.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private int code;
    private String message;
    private Object data;

    /**
     * 统一错误返回
     * @param message 错误信息
     * @return Result
     */
    public static Result  error(String message){
        return new Result(500,message,null);
    }
    /**
     * 统一成功返回
     * @param data 数据
     * @return Result
     */
    public static Result  success(Object data){
        return new Result(200,"success",data);
    }
    /**
     * 统一成功返回
     * @return Result
     */
    public static Result  success(){
        return new Result(200,"success",null);
    }
}
